package com.yang.designmode.singleton;

public class EnumSingletonTest {
    public static void main(String[] args) {
        for (int i=0;i<10;i++){
            new Thread(()->{
                System.out.println(EnumSingleton.INSTANCE);
            }).start();
        }
        System.out.println("===");
        EnumSingleton instance_1 = EnumSingleton.INSTANCE;
        instance_1.setValue(20);
        System.out.println(instance_1.getValue());
        EnumSingleton instance_2 = EnumSingleton.INSTANCE;
        System.out.println(instance_2.getValue());
        System.out.println(instance_1 == instance_2);
    }
}
